package com.supermap.business.cloud.productC;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.cloud.productC.ProductCloudService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author aqua
 * @description
 * @date 2018年12月04 下午 2:47
 * @email 1301584033@qq.com
 */
@Controller
@RequestMapping("/cloud/productC")
public class ProductCloudController {

    @Reference(timeout = 10000)
    private ProductCloudService productCloudService;

    @GetMapping("/getGroupProduct")
    @ResponseBody
    public JSONUtil getGroupProduct(Integer pageNum, Integer pageSize){
        return  productCloudService.getGroupProduct(pageNum,pageSize);
    }

    /**
     * 获取公共服务产品统计数
     */
    @GetMapping("/getProductByCropIdCountSum")
    @ResponseBody
    public Map<String,Object> getProductByCropName(String cropId){
        return  productCloudService.getProductCountSumBycropId(cropId);
    }


    /**
     * 获取重庆市各区县作物农田总数
     */
    @GetMapping("/getCqGroupAreaFarmCorpCountSum")
    @ResponseBody
    public JSONUtil getCqGroupAreaFarmCorpCountSum(String crop){
        return  productCloudService.getCqGroupAreaFarmCorpCountSum(crop);
    }

    /**
     * 获取专家产品专家建议最多的N个专家排序
     */
    @GetMapping("/getExpertSuggestBycropCount")
    @ResponseBody
    public JSONUtil getExpertSuggestBycropCount(String areaCode,String crop,Integer pageSize){
        return  productCloudService.getExpertSuggestBycropCount(areaCode,crop,pageSize);
    }

}
